var par:string;
    k,i,j:integer;
begin
  readln(par);
  readln(k);
  par:=par+'A';
  for i:=1 to k do
    begin
      j:=1;
      while par[j]>=par[j+1] do
        j:=j+1;
      delete(par,j,1);
    end;
  delete(par,length(par),1);    
  writeln(par);
end.
